package com.artPreter.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 警报设备表
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-22
 */
@Data
@TableName("jv_alert_device")
public class AlertDevice implements Serializable {

    private static final long serialVersionUID = 1L;

    //ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    //设备uuid")
    @TableField("uuid")
    private String uuid;

    //创建时间")
    @TableField("create_time")
    private Integer createTime;

    //排序")
    @TableField("sort")
    private Integer sort;

    //备注")
    @TableField("remarks")
    private String remarks;

    //启用：1 禁用:0")
    @TableField("status")
    private Integer status;

    //房间id")
    @TableField("room")
    private String room;

    //楼层id")
    @TableField("floor")
    private String floor;

    //区域id")
    @TableField("position")
    private String position;

    //使用设备id")
    @TableField("device_id")
    private String deviceId;

    //使用设备名称")
    @TableField("device_name")
    private String deviceName;

    //主机uuid")
    @TableField("main_id")
    private String mainId;

    //主机设备id")
    @TableField("main_device_id")
    private String mainDeviceId;

    //设备坐标")
    @TableField("loc_x")
    private Double locX;

    //设备坐标")
    @TableField("loc_y")
    private Double locY;

    //1:烟禁  2:漏水")
    @TableField("type")
    private Integer type;

    //IP第一位")
    @TableField("place1")
    private Integer place1;

    //IP第二位")
    @TableField("place2")
    private Integer place2;

    //IP第三位")
    @TableField("place3")
    private Integer place3;

    //IP第四位")
    @TableField("place4")
    private Integer place4;

    @TableField("ot1")
    private Integer ot1;

    @TableField("ot2")
    private Integer ot2;

    public AlertDevice() {
    }

    public AlertDevice(AlertDevice alertDevice, int type) {
        switch (type){
            case 1: // 修改
                //排序
                this.sort = alertDevice.getSort();
                //备注
                this.remarks = alertDevice.getRemarks();
                //启用：1 禁用:0
                this.status = alertDevice.getStatus();
                //房间id
               this.room = alertDevice.getRoom();
                //楼层id
                this.floor = alertDevice.getFloor();
                //区域id
                this.position = alertDevice.getPosition();
                //使用设备id
                this.deviceId = alertDevice.getDeviceId();
                //使用设备名称")
                this.deviceName = alertDevice.getDeviceName();
                //主机uuid
                this.mainId = alertDevice.getMainId();
                //主机设备id
                this.mainDeviceId = alertDevice.getMainDeviceId();
                //设备坐标
                this.locX = alertDevice.getLocX();
                //设备坐标
                this.locY = alertDevice.getLocY();
                //1:烟禁  2:漏水
                this.type = alertDevice.getType();
                //IP第一位
                this.place1 = alertDevice.getPlace1();
                //IP第二位
                this.place2 = alertDevice.getPlace2();
                //IP第三位
                this.place3 = alertDevice.getPlace3();
                //IP第四位
                this.place4 = alertDevice.getPlace4();
                //延迟
                this.ot1 = alertDevice.getOt1();
                this.ot2 = alertDevice.getOt2();
                break;
            case 2: // 启用/禁用
                if(alertDevice.getStatus()==0){
                    this.status = 1;
                }else{
                    this.status = 0;
                }
                break;
        }
    }
}
